package customerEnter.Frame.ehcache.Listen;

import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Status;
import net.sf.ehcache.event.CacheManagerEventListener;

/**
 * 分佈式緩存的管理監聽
 * 
 * 类名称：EcacheListEnerManage 类描述： 创建人：dy 创建时间：2016-4-25 上午10:31:41
 * 
 */
public class EcacheListEnerManage implements CacheManagerEventListener {

	private final CacheManager	cacheManager;

	public EcacheListEnerManage(CacheManager cacheManager) {
		this.cacheManager = cacheManager;
	}

	public void init() throws CacheException {
		System.out.println("----------------緩存系統初始化.....");
	}

	public Status getStatus() {
		System.out.println("当前監聽器所处的状态" + CacheManager.DEFAULT_NAME);
		return null;
	}

	public void dispose() throws CacheException {
		System.out.println("----------------釋放緩存-------------------");
	}

	public void notifyCacheAdded(String cacheName) {

		System.out.println("----------------添加系統緩存......." + cacheName);
		System.out.println(cacheManager.getCache(cacheName));
	}

	public void notifyCacheRemoved(String cacheName) {
		System.out.println("-----------------刪除系統緩存......" + cacheName);
	}

}
